package com.googlecode.wicketslides;

import java.io.Serializable;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.request.resource.PackageResourceReference;

public class ImageLoader implements Serializable
{

	private static final long serialVersionUID = 1L;

	protected void populate(final ListItem<SlideshowImage> item)
	{
		item.add(new Image("image", new PackageResourceReference(WicketSlides.class, "image"))
				.add(new AttributeModifier("src", item.getModel())));
		item.add(new Image("thumb", new PackageResourceReference(WicketSlides.class, "thumb"))
				.add(new AttributeModifier("src", item.getModel())));
		item.add(new Label("title", ((SlideshowImage)item.getDefaultModelObject()).getTitle()));
		item.add(new Label("description", ((SlideshowImage)item.getDefaultModelObject())
				.getDescription()));
	}

}
